~"minilib.cmn"
~score
~maxScore

# Takes two strings: answer and question, will check if answer matches
# expected answer (disregarding case), returns 0 or 1. Also manages score
# counting.
ask:
  0 "~~~ " --> --> 0 " ~~~" -->

  0 "your answer: " 10 --> 

  strToLower
  strRead strToLower
  strEq

  $0 ?
    0 10 "Yes!" -->
    $score ++ $:score
  ; 
    0 10 "No :(" -->
  .

  $maxScore ++ $:maxScore
.

0 10 "Welcome to today's quiz!" -->

0 "comun" 0 "What is the best programming language?" ask
0 "sun" 0 "What's our closest star?" ask
0 "platypus" 0 "Who's the most famous mammal that lays eggs?" ask
0 "capitalism" 0 "What's the name of the worst economic system based on abuse of workers?" ask
0 "11" 0 "What's the fifth prime number?" ask
0 "einstein" 0 "Which physicist is the author of Theory of Relativity (last name)?" ask
0 "1945" 0 "In which year did World War II end?" ask
0 "cat" 0 "What's an animal that's also a standard Unix utility for printing files?" ask
0 "nodnol" 0 "What's the capital of United Kingdom, spelled backwards?" ask
0 "yes" 0 "Did you enjoy this quiz?" ask

0 "That's all! Your score: " 10 -->
$score numPrint "/" -> $maxScore numPrint 10 ->
